import java.io.IOException;
import java.util.Vector;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;


public class sprite {
	
	public int currentX, currentY; // To hold current position of the 'X'
	public int oldX, oldY;
	public int width; 
	public int height; 	
	public int COL = 3;	
	public int ROW = 4;
	public static int currFrame = 0;
	public static int currRow = 0;
	public String direc;	
//	public boolean isMovedLeft , isMovedRight;
	public Image imgSprite;
	public Sprite sprite;
	
	public static boolean isDraw = true;
	
	
	public static Vector ActorVector = new Vector();
	
	public sprite(int x, int y)
	{		
		currentX = x;
		currentY = y;			
		try {
			imgSprite = Image.createImage("/cuop1.png");
			width = imgSprite.getWidth()/COL;
			height = imgSprite.getHeight()/ROW;
			sprite = new Sprite(imgSprite,width,height);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();			
		}
		//mstate = state_stand;		
	}
	
	public sprite(int x, int y,String path)
	{		
		currentX = x;
		currentY = y;				
		direc = path;
		try {
			imgSprite = Image.createImage(path);
			width = imgSprite.getWidth()/COL;
			height = imgSprite.getHeight()/ROW;
			sprite = new Sprite(imgSprite,width,height);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();			
		}		
			
	}
	
	public void update()
	{
		
	}
	
	public void draw(Graphics g)
	{
		if(isDraw)
		{
			g.setColor(0x0000ff);		
			g.drawRegion(imgSprite, currFrame * width, currRow * height, width, height, 0, currentX,  currentY, Graphics.TOP|Graphics.LEFT);
		}
	}
	

}
